-module(killServers).

-export([kill_servers/1, kill_main/0]).

kill_servers(ProjectId) ->
	{list_to_atom(hd(io_lib:format("~w",[ProjectId]))), pronection_server@hamberg.it.uu.se} ! {crash , self()},
		receive 
			{ok, ClientPid} ->
				ok

		after 2000 ->
			io:format("Prodject server ~w dosen't exist ~ n", [ProjectId]),
			ok
		end.


kill_main() ->
	{pronection_server, pronection_server@hamberg.it.uu.se} ! {crash , self()},
		receive 
			{ok, ClientPid} -> 
				ok

		after 2000 ->
			io:format("MainServer timedout restarting! ~n", []),
    			mainServer:start(),
			ok
		end.
